import os

path = "/home/cho/Desktop/robotics/image/test/"
index = 1

for file in os.listdir(path):
    image_path = os.path.join(path, file)
    new_name = str(index) + '.bmp'
    new_image_name = os.path.join(path, new_name)
    os.rename(image_path, new_image_name)
    print("以前的文件名和对应现在的序号", file + '---' + str(index))
    index += 1
